package com.soap.controller;

import com.soap.service.UserSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @Description
 * @Author ZhangPY
 * @Date 2020/7/2
 */
@RestController
@RequestMapping(value = "/user")
public class UserSearchController {

    @Autowired
    private UserSearchService userSearchService;

    /**
     * 批量插入user
     * @param mapList
     * @return
     */
    @RequestMapping(value = "/batchInsertPerson", method = RequestMethod.POST)
    public String batchInsertUser(@RequestBody List<Map<String,Object>> mapList) {
        return userSearchService.batchInsertUser(mapList);
    }

    /**
     * 插入user
     * @return
     */
    @RequestMapping(value = "/insertUser", method = RequestMethod.POST)
    public String insertUser(@RequestBody Map<String, Object> jsonMap) {
        return userSearchService.insertUser(jsonMap);
    }

    /**
     * 创建user索引库
     * @param source
     * @return
     */
    @RequestMapping(value = "/createUserIndex", method = RequestMethod.POST)
    public String createUserIndex(String source) {
        return userSearchService.createUserIndex(source);
    }

}
